package com.hnzbxy.api.biz.entity;

import com.wuwenze.poi.annotation.Excel;
import com.wuwenze.poi.annotation.ExcelField;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 班级信息实体类（避免class关键字，表名tb_class_info）
 */
@Data
@Excel("班级信息表") // Excel导出表名不变
@Table(name = "class_info") // 新表名：tb_class_info
public class ClassInfo {

    /**
     * 班级主键ID
     */
    @Id
    @Column(name = "id")
    @ExcelField(value = "班级编号", width = 50)
    private Long id;

    /**
     * 班级名称（如“开发23班”）
     */
    @Column(name = "class_name")
    @ExcelField(value = "班级名称", width = 120)
    private String className;

    /**
     * 是否合班（0=非合班，1=合班）
     */
    @Column(name = "is_combined")
    @ExcelField(
        value = "是否合班",
        readConverterExp = "非合班=0,合班=1",
        writeConverterExp = "0=非合班,1=合班",
        width = 80
    )
    private Integer isCombined;

    /**
     * 合班关联班级ID组（多ID用逗号分隔）
     */
    @Column(name = "combined_class_ids")
    @ExcelField(value = "合班关联班级ID", width = 150)
    private String combinedClassIds;

    /**
     * 开班时间
     */
    @Column(name = "start_time")
    @ExcelField(value = "开班时间", dateFormat = "yyyy-MM-dd", width = 120)
    private Date startTime;

    /**
     * S1阶段升学时间
     */
    @Column(name = "s1_upgrade_time")
    @ExcelField(value = "S1升学时间", dateFormat = "yyyy-MM-dd", width = 120)
    private Date s1UpgradeTime;

    /**
     * S2阶段升学时间
     */
    @Column(name = "s2_upgrade_time")
    @ExcelField(value = "S2升学时间", dateFormat = "yyyy-MM-dd", width = 120)
    private Date s2UpgradeTime;

    /**
     * Y1阶段升学时间
     */
    @Column(name = "y1_upgrade_time")
    @ExcelField(value = "Y1升学时间", dateFormat = "yyyy-MM-dd", width = 120)
    private Date y1UpgradeTime;

    /**
     * 毕业时间
     */
    @Column(name = "graduation_time")
    @ExcelField(value = "毕业时间", dateFormat = "yyyy-MM-dd", width = 120)
    private Date graduationTime;

    /**
     * 历任教员ID组（多ID用逗号分隔）
     */
    @Column(name = "teacher_ids")
    @ExcelField(value = "历任教员ID", width = 150)
    private String teacherIds;

    /**
     * 历任班主任ID组（多ID用逗号分隔）
     */
    @Column(name = "class_advisor_ids")
    @ExcelField(value = "历任班主任ID", width = 150)
    private String classAdvisorIds;

    /**
     * 当前班主任ID（关联class_advisor.id）
     */
    @Column(name = "current_ca_id")
    @ExcelField(value = "当前班主任ID", width = 80)
    private Long currentCaId;

    /**
     * 当前教员ID（关联teacher.id）
     */
    @Column(name = "current_tc_id")
    @ExcelField(value = "当前教员ID", width = 80)
    private Long currentTcId;

    /**
     * 所属年级（如“S1”“S2”）
     */
    @Column(name = "grade")
    @ExcelField(value = "所属年级", width = 80)
    private String grade;

    /**
     * 班级状态（0=未开班，1=在读，2=毕业）
     */
    @Column(name = "class_status")
    @ExcelField(
        value = "班级状态",
        readConverterExp = "未开班=0,在读=1,毕业=2",
        writeConverterExp = "0=未开班,1=在读,2=毕业",
        width = 80
    )
    private Integer classStatus;

    /**
     * 班级备注
     */
    @Column(name = "remark")
    @ExcelField(value = "班级备注", width = 200)
    private String remark;

    /**
     * 创建时间（系统自动填充）
     */
    @Column(name = "create_time")
    @ExcelField(value = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 180)
    private Date createTime;

    /**
     * 最后修改时间（系统自动更新）
     */
    @Column(name = "update_time")
    @ExcelField(value = "最后修改时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 180)
    private Date updateTime;
}